<%@ page import="cn.gudian.cms.News.ArcType" %>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <meta name="layout" content="main"/>
  <title><g:message code="arcType.create" default="Create ArcType"/></title>
  <script src="/js/Pinyin-min.js" type="text/javascript"></script>
  <script language="JavaScript">
    function pinyinfun() {
      var name = document.getElementById("name").value;
      document.getElementById("path").value = "/" + CC2PY(name, 1); //转换为拼音;
    }
  </script>
  <ckeditor:resources/>
</head>
<body>
<div class="nav">
  <span class="menuButton"><a class="home" href="${createLinkTo(dir: '')}"><g:message code="home" default="Home"/></a></span>
  <span class="menuButton"><g:link class="list" action="list"><g:message code="arcType.list" default="ArcType List"/></g:link></span>
</div>
<div class="body">
  <h1><g:message code="arcType.create" default="Create ArcType"/></h1>
  <g:if test="${flash.message}">
    <div class="message"><g:message code="${flash.message}" args="${flash.args}" default="${flash.defaultMessage}"/></div>
  </g:if>
  <g:hasErrors bean="${arcTypeInstance}">
    <div class="errors">
      <g:renderErrors bean="${arcTypeInstance}" as="list"/>
    </div>
  </g:hasErrors>
  <g:form action="save" method="post">
    <div class="dialog">
      <table>
        <tbody>
        <g:if test="${params.id}">
          <input type="hidden" name="parent.id" id="parent.id" value="${params.id}"/>
        </g:if>
        <g:else>
          <input type="hidden" name="parent.id" id="parent.id"/>
        </g:else>

        <g:if test="${params.mode}">
          <input type="hidden" name="mode" id="mode" value="${params.mode}"/>

        </g:if>
        <g:else>
          <tr class="prop">
            <td valign="top" class="name">
              <label for="mode"><g:message code="arcType.mode" default="Mode"/>:</label>
            </td>
            <td valign="top" class="value ${hasErrors(bean: arcTypeInstance, field: 'mode', 'errors')}">
              <g:select name="mode" from="${arcTypeInstance.modeStates}" value="${arcTypeInstance?.mode}" optionKey="key" optionValue="value" valueMessagePrefix="arcType.mode"/>
              *请注意选择模块，添加后不可修改，如果选择错误只能删除重新添加。
            </td>
          </tr>
        </g:else>
        <tr class="prop">
          <td valign="top" class="name">
            <label for="name"><g:message code="arcType.name" default="Name"/>:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: arcTypeInstance, field: 'name', 'errors')}">
            <g:textField name="name" value="${fieldValue(bean: arcTypeInstance, field: 'name')}" onblur="pinyinfun();"/>

          </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="path"><g:message code="arcType.path" default="Path"/>:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: arcTypeInstance, field: 'path', 'errors')}">
            <g:textField name="path" value="${fieldValue(bean: arcTypeInstance, field: 'path')}"/>

          </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="keywords"><g:message code="arcType.keywords" default="Keywords"/>:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: arcTypeInstance, field: 'keywords', 'errors')}">
            <g:hiddenField name="tempindex" value="${arcTypeInstance.tempindex==null?'/Templet/index.html':arcTypeInstance.tempindex}"/>
            <g:hiddenField name="templist" value="${arcTypeInstance.templist==null?'/Templet/listPage_templet.html':arcTypeInstance.templist}"/>
            <g:hiddenField name="temparticle" value="${arcTypeInstance.temparticle==null?'/Templet/contentPage_templet.html':arcTypeInstance.temparticle}"/>
            <g:hiddenField name="description" value="${fieldValue(bean: arcTypeInstance, field: 'description')}"></g:hiddenField>
             <g:hiddenField name="ishidden" value="false"/>
            <g:textArea name="keywords"  value="${fieldValue(bean: arcTypeInstance, field: 'keywords')}" style="width:95%;height:60px;"/>
          </td>
        </tr>

   

        </tbody>
      </table>
    </div>
    <div class="buttons">
      <span class="button"><g:submitButton name="create" class="save" value="${message(code: 'create', 'default': 'Create')}"/></span>
    </div>
  </g:form>
</div>
</body>
</html>
